package shapes;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Shape[] shapes = new Shape[n];
		for(int i = 0;i<n;i++){
			String str = in.next();
			if(str.equals("react")){
				Rectangle rect = new Rectangle(in.nextInt(),in.nextInt());
				shapes[i] = rect;
				continue;
			}
			if(str.equals("cir")){
				Circle cir = new Circle(in.nextInt());
				shapes[i] = cir;
				continue;
			}
		}
		System.out.println(Shape.sumAllperimeter(shapes));
		System.out.println(Shape.sumAllArea(shapes));
		System.out.println(Arrays.deepToString(shapes));
		for (Shape shape : shapes) {
			System.out.println(shape.getClass()+","+shape.getClass().getSuperclass());
		}
		in.close();
	}
}
